package com.ruoyi.lm.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.lm.mapper.LmRequireMapper;
import com.ruoyi.lm.domain.LmRequire;
import com.ruoyi.lm.service.ILmRequireService;
import com.ruoyi.common.core.text.Convert;

/**
 * 需求单Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-09-02
 */
@Service
public class LmRequireServiceImpl implements ILmRequireService 
{
    @Autowired
    private LmRequireMapper lmRequireMapper;

    /**
     * 查询需求单
     * 
     * @param id 需求单ID
     * @return 需求单
     */
    @Override
    public LmRequire selectLmRequireById(String id)
    {
        return lmRequireMapper.selectLmRequireById(id);
    }

    /**
     * 查询需求单列表
     * 
     * @param lmRequire 需求单
     * @return 需求单
     */
    @Override
    public List<LmRequire> selectLmRequireList(LmRequire lmRequire)
    {
        return lmRequireMapper.selectLmRequireList(lmRequire);
    }

    @Override
    public List<LmRequire> selectLmRequireListRe(LmRequire lmRequire) {
        return lmRequireMapper.selectLmRequireListRe(lmRequire);
    }

    /**
     * 新增需求单
     * 
     * @param lmRequire 需求单
     * @return 结果
     */
    @Override
    public int insertLmRequire(LmRequire lmRequire)
    {
        lmRequire.setId(IdWorker.getId());
        lmRequire.setCreateTime(DateUtils.getNowDate());
        return lmRequireMapper.insertLmRequire(lmRequire);
    }

    @Override
    public int getRequireCount() {
        return lmRequireMapper.getRequireCount();
    }

    @Override
    public int getClickNum() {
        return lmRequireMapper.getClickNum();
    }

    /**
     * 修改需求单
     * 
     * @param lmRequire 需求单
     * @return 结果
     */
    @Override
    public int updateLmRequire(LmRequire lmRequire)
    {
        lmRequire.setUpdateTime(DateUtils.getNowDate());
        return lmRequireMapper.updateLmRequire(lmRequire);
    }

    /**
     * 删除需求单对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteLmRequireByIds(String ids)
    {
        return lmRequireMapper.deleteLmRequireByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除需求单信息
     * 
     * @param id 需求单ID
     * @return 结果
     */
    @Override
    public int deleteLmRequireById(String id)
    {
        return lmRequireMapper.deleteLmRequireById(id);
    }
}
